import Vue from "vue"
import VueRouter from "vue-router"
// 引入组件
import home from './components/HomePage.vue'
import about from './components/AboutPage.vue'
import main from './components/MainPage.vue'
import header from './components/HeaderPage.vue'
import slider from './components/SliderPage.vue'
import ComponentPage from "./components/ComponentPage.vue"
// 注册路由组件
Vue.use(VueRouter)
// 定义路由映射规则
const routes = [
    {
        path: "/home",
        component: home
    },
    {
        path: "/about",
        component: about
    },
    {
        path: "/",
        components: {
            default: main,
            header: header,
            slider: slider
        }
    },
    {
        path: '/rename/:userId',
        name: 'user',
        component: ComponentPage
    }
]
const router = new VueRouter({
    routes
})
export default router